<template>
  <div class="box">
    <Echars :xData="xData" :yData="yData"></Echars>
  </div>
</template>

<script>
import { totaldataReq } from "@/api/home.api";
import Echars from "@/components/echars/Echars.vue";
export default {
  components: { Echars },
  data() {
    return {
      xData: [],
      yData: [],
    };
  },

  created() {
    totaldataReq().then((res) => {
      console.log(res);
      this.xData = res.data.xData;
      this.yData = [
        {
          name: "订单量",
          stack: "Total",
          areaStyle: {},
          emphasis: {
            focus: "series",
          },
          data: res.data.orderData,
        },
        {
          name: "销售额",
          stack: "Total",
          areaStyle: {},
          emphasis: {
            focus: "series",
          },
          data: res.data.amountData,
        },
      ];
    });
  },
};
</script>

<style lang="less" scoped>
.box{
    width: 100%;
    height: 100%;
}
</style>